﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Pattern_Observer
{
    abstract class Observer
    {
        protected Subject subject;
        public abstract void Update();
    }

    class Observer1 : Observer
    {
        string name = string.Empty;
        public Observer1(string name , Subject subject)
        {
            this.name = name;
            this.subject = subject;
        }

        public override void Update()
        {
            Console.WriteLine("观察者{0}新状态{1}",name,subject.SubjectState);
            Console.WriteLine();
        }
    }
}
